package GUILayer;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import java.awt.Font;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.Color;
import javax.swing.border.TitledBorder;
import javax.swing.border.LineBorder;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class OrderGUI extends JFrame {

	private JPanel contentPane;
	private JTextField textID;
	private JTextField textSerialNumber;
	private JTextField textStaffPhone;
	private JTextField textCustomerPhone;
	private JTextField textOrderID;
	private JTextField textDeleteOrderID;
	private JTextField textFindOrder;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					OrderGUI frame = new OrderGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public OrderGUI() {
		setTitle("Order UI\r\n");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		setSize(600,400);
		contentPane = new JPanel();
		contentPane.setBackground(Color.GRAY);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel PanelEnterInformations = new JPanel();
		PanelEnterInformations.setLayout(null);
		PanelEnterInformations.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), "Enter Informations", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(255, 255, 255)));
		PanelEnterInformations.setBackground(Color.GRAY);
		PanelEnterInformations.setBounds(10, 32, 547, 183);
		contentPane.add(PanelEnterInformations);
		
		JButton btnAddOrder = new JButton("Add Order");
		btnAddOrder.setToolTipText("Add an Order to the database");
		btnAddOrder.setBounds(385, 147, 150, 25);
		PanelEnterInformations.add(btnAddOrder);
		
		JLabel label = new JLabel("ID:");
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setForeground(Color.WHITE);
		label.setBounds(10, 24, 100, 20);
		PanelEnterInformations.add(label);
		
		JLabel lblSerialNumber = new JLabel("Serial Number:");
		lblSerialNumber.setHorizontalAlignment(SwingConstants.CENTER);
		lblSerialNumber.setForeground(Color.WHITE);
		lblSerialNumber.setBounds(145, 24, 100, 20);
		PanelEnterInformations.add(lblSerialNumber);
		
		JLabel lblCustomerPhone = new JLabel("Customer Phone:");
		lblCustomerPhone.setHorizontalAlignment(SwingConstants.CENTER);
		lblCustomerPhone.setForeground(Color.WHITE);
		lblCustomerPhone.setBounds(290, 24, 100, 20);
		PanelEnterInformations.add(lblCustomerPhone);
		
		JLabel lblStaffPhone = new JLabel("Staff Phone:");
		lblStaffPhone.setHorizontalAlignment(SwingConstants.CENTER);
		lblStaffPhone.setForeground(Color.WHITE);
		lblStaffPhone.setBounds(435, 24, 100, 20);
		PanelEnterInformations.add(lblStaffPhone);
		
		JLabel lblOrderId = new JLabel("Order ID:");
		lblOrderId.setHorizontalAlignment(SwingConstants.CENTER);
		lblOrderId.setForeground(Color.WHITE);
		lblOrderId.setBounds(10, 74, 100, 20);
		PanelEnterInformations.add(lblOrderId);
		
		textID = new JTextField();
		textID.setColumns(10);
		textID.setBounds(10, 47, 100, 20);
		PanelEnterInformations.add(textID);
		
		textSerialNumber = new JTextField();
		textSerialNumber.setColumns(10);
		textSerialNumber.setBounds(145, 47, 100, 20);
		PanelEnterInformations.add(textSerialNumber);
		
		textStaffPhone = new JTextField();
		textStaffPhone.setColumns(10);
		textStaffPhone.setBounds(435, 47, 100, 20);
		PanelEnterInformations.add(textStaffPhone);
		
		textCustomerPhone = new JTextField();
		textCustomerPhone.setColumns(10);
		textCustomerPhone.setBounds(290, 47, 100, 20);
		PanelEnterInformations.add(textCustomerPhone);
		
		textOrderID = new JTextField();
		textOrderID.setColumns(10);
		textOrderID.setBounds(10, 95, 100, 20);
		PanelEnterInformations.add(textOrderID);
		
		JButton button = new JButton("Clear");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) 
			{
				clear();
			}
		});
		button.setBounds(196, 147, 150, 25);
		PanelEnterInformations.add(button);
		
		JPanel PanelDeleteOrder = new JPanel();
		PanelDeleteOrder.setLayout(null);
		PanelDeleteOrder.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), "Delete Order", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(255, 255, 255)));
		PanelDeleteOrder.setBackground(Color.GRAY);
		PanelDeleteOrder.setBounds(10, 226, 170, 96);
		contentPane.add(PanelDeleteOrder);
		
		JButton btnDeleteOrder = new JButton("Delete Order");
		btnDeleteOrder.setBounds(10, 60, 150, 25);
		PanelDeleteOrder.add(btnDeleteOrder);
		
		textDeleteOrderID = new JTextField();
		textDeleteOrderID.setText("Enter ID:");
		textDeleteOrderID.setHorizontalAlignment(SwingConstants.LEFT);
		textDeleteOrderID.setColumns(10);
		textDeleteOrderID.setBounds(10, 30, 150, 20);
		PanelDeleteOrder.add(textDeleteOrderID);
		
		JPanel PanelFindOrder = new JPanel();
		PanelFindOrder.setLayout(null);
		PanelFindOrder.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), "Find Order", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(255, 255, 255)));
		PanelFindOrder.setBackground(Color.GRAY);
		PanelFindOrder.setBounds(209, 226, 170, 96);
		contentPane.add(PanelFindOrder);
		
		JButton btnFindOrder_1 = new JButton("Find Order");
		btnFindOrder_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) 
			{
				findOrder();
			}
		});
		btnFindOrder_1.setBounds(10, 60, 150, 25);
		PanelFindOrder.add(btnFindOrder_1);
		
		textFindOrder = new JTextField();
		textFindOrder.setText("Enter ID:");
		textFindOrder.setHorizontalAlignment(SwingConstants.LEFT);
		textFindOrder.setColumns(10);
		textFindOrder.setBounds(10, 30, 150, 20);
		PanelFindOrder.add(textFindOrder);
	}
		private void findOrder()
		{
		
		}
		private void clear()
		{
			textID.setText("");
			textSerialNumber.setText("");
			textCustomerPhone.setText("");
			textStaffPhone.setText("");
			textOrderID.setText("");
		}
		

}
